Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update custom algorithms example #209

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update custom algorithms example #209

wants to merge 1 commit into from

Conversation

OR13
Copy link
Contributor

@OR13 OR13 commented Oct 28, 2024

This pull request updates the readme section describing custom algorithms, and provides an example test.

The current instructions in this section are not very helpful:

https://github.com/search?q=repo%3Averaison%2Fgo-cose%20RegisterAlgorithm&type=code

Signed-off-by: Orie Steele <orie@transmute.industries>
@OR13 OR13 force-pushed the custom-signer-example branch from d153ce2 to 223b104 Compare October 28, 2024 20:09
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.27%. Comparing base (92fbe95) to head (223b104).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
- Coverage   92.35%   91.27%   -1.09%     
==========================================
  Files          12       12              
  Lines        1622     2005     +383     
==========================================
+ Hits         1498     1830     +332     
- Misses         68      119      +51     
  Partials       56       56              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SteveLasker
Copy link
Contributor

Thanks @OR13,
Can we get some 👀's from some of the other maintainers?

Copy link
Contributor

@thomas-fossati thomas-fossati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

I left a couple of typo notes inline.

Comment on lines +284 to +286
verify_error := sign1.Verify(nil, verifier)

if verify_error != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usual golang typo conventions

Suggested change
verify_error := sign1.Verify(nil, verifier)
if verify_error != nil {
verifyError := sign1.Verify(nil, verifier)
if verifyError != nil {

if verify_error != nil {
t.Fatalf("Verification failed")
} else {
// fmt.Println(cbor.Diagnose(signature))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a beauty, isn't it?

var payload = []byte("hello post quantum signatures")
signature, _ := cose.Sign1(nil, ks, headers, payload, nil)
var sign1 cose.Sign1Message
sign1.UnmarshalCBOR(signature)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe ignore error more explicitly:

Suggested change
sign1.UnmarshalCBOR(signature)
_ = sign1.UnmarshalCBOR(signature)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants